import Vue from 'vue'
import VueRouter from "vue-router";


//导入需要配置的路由组件
import Login from '../disviews/Login'//登录

import main from '../disviews/main'//首页

import register from '../disviews/register'//注册

import Worm from '../disviews/Worm' //虫害页面

import disease from '../disviews/disease';//病害页面

import mouse from '../disviews/mouse' //鼠害页面

import user from '../systemInfo/user'//查询用户页面

import record from '../systemInfo/record'//日志信息

import region from '../disasterprevention/region' //区域一览

import cls from '../disasterprevention/cls'//小班管理

import eve from '../disasterprevention/event'//事件记录


import exp from '../expertconsultation/expert' //专家
import con from '../expertconsultation/consult'//会商


import agn from '../inventory/agentia.vue' //药物 器械

import mov from '../inventory/move.vue'//出库

import addOut from '../inventory/addOut.vue'//添加出库信息

const originalPush = VueRouter.prototype.push
// 修改 原型对象中的push方法
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err=>err)
}




Vue.use(VueRouter)

const routes = [

    {path:"/login",component:Login},
    {path:"/reg",component:register},
    {path:"/main",component:main,
    children:[       //嵌套路由 
    {path:"/main/Worm",component:Worm},
    {path:"/main/disease",component:disease},
    {path:"/main/mouse",component:mouse},
    {path:"/main/user",component:user},
    {path:"/main/red",component:record},
    {path:"/main/reg",component:region},
    {path:"/main/cls",component:cls},
    {path:"/main/eve",component:eve},
    {path:"/main/exp",component:exp},
    {path:"/main/con",component:con},
    {path:"/main/agn",component:agn},
    {path:"/main/mov",component:mov},
    {path:"/main/addOut",component:addOut},
]
},


]


export default new VueRouter({
    mode:'history',
    routes
})